package com.yly;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/**
 * Created by tj on 2016/10/13.
 */
@Repository
public interface UserDao {

    @Select("SELECT username FROM user WHERE id = #{userId}")
    public String getUser(@Param("userId") int userId);

//    @Insert("INSERT INTO user (id,username,password) VALUES (#{id},#{username},#{password})")
    @Insert("INSERT INTO user (id,username,password) VALUES (#{id},#{username},#{password})")
    public void addUser(User user);

    @Update("UPDATE user SET password=#{password} WHERE id=#{id}")
    public void updateUser(User user);

    @Delete("DELETE FROM user WHERE id=#{id}")
    public void deleteUser(int id);

}
